<?php
require_once(FWK_MODEL."AbsComponente.class.php");

class MultBox extends AbsComponente {

	private $objDaoOrigem;
	private $objDaoDestino;

	private $param1;
	private $param2;
	private $param3;
	private $param4;

	public function setDaoOrigem($daoOrigem){
		require_once(PASTA_DAO.$daoOrigem.".class.php");
		$this->objDaoOrigem = new $daoOrigem();
	}

	public function getDaoOrigem(){
		return $this->objDaoOrigem;
	}
	
	public function setDaoDestino($daoDestino){
		require_once(PASTA_DAO.$daoDestino.".class.php");
		$this->objDaoDestino = new $daoDestino();
	}

	public function getDaoDestino(){
		return $this->objDaoDestino;
	}

	public function setParam1($param1){
		$this->param1 = $param1;
		self::getDaoComp()->setParam1($param1);
	}

	public function getParam1(){
		return $this->param1;
	}

	public function setParam2($param2){
		$this->param2 = $param2;
		self::getDaoComp()->setParam2($param2);
	}

	public function getParam2(){
		return $this->param2;
	}

	public function setParam3($param3){
		$this->param3 = $param3;
		self::getDaoComp()->setParam3($param3);
	}

	public function getParam3(){
		return $this->param3;
	}

	public function setParam4($param4){
		$this->param4 = $param4;
		self::getDaoComp()->setParam4($param4);
	}

	public function getParam4(){
		return $this->param4;
	}
	
	
	public function getComponente($value = null){
		parent::getObjJs()->addJs("../".JS_FWK."multBox.js");
		
		$arrOrigem = self::getDaoOrigem()->getListOrigem();
		$arrDestino = self::getDaoDestino()->getListDestino($value);
		
		$arrItensOrigem = array();
		for($i=0;$i<count($arrOrigem);$i++){
			$add = true;
			for($j=0;$j<count($arrDestino);$j++){
				if($arrOrigem[$i][0] == $arrDestino[$j][0]){
					$add = false;
				}
			}
			if($add)
				$arrItensOrigem[] = $arrOrigem[$i];
		}
		
		parent::getObjSmarty()->assign("ARR_DADOS_ORIGEM",Utf8Parsers::matrizUtf8Encode($arrItensOrigem));
		parent::getObjSmarty()->assign("ARR_DADOS_DESTINO",Utf8Parsers::matrizUtf8Encode($arrDestino));
		$strTela = parent::getObjSmarty()->fetch("../".TPLS_FWK."multBox.tpl");
		print($strTela);
	}
	
	


}
?>